﻿#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
//1 + (-1)
//原码相加
//00000000 00000000 00000000 00000001 --> 1
//10000000 00000000 00000000 00000001 --> -1
//10000000 00000000 00000000 00000010 --> -2

//1的原反补完全相同，-1的补仍需计算
//00000000 00000000 00000000 00000001 --> 1的补码
//10000000 00000000 00000000 00000001 --> -1的原码
//11111111 11111111 11111111 11111110 --> -1的反码
//11111111 11111111 11111111 11111111 --> -1的补码
//补码相加
//1 00000000 00000000 00000000 00000000
//int main()
//{
//	int num = 10;
//	int a = num << 1;
//	printf("a = %d\n", a);
//	printf("num = %d\n", num);
//
//	return 0;
//
//}
//int main()
//{
//	int num = -8;
//	int n = num >> 1;
//	printf("n= %d\n", n);
//	printf("num= %d\n", num);
//	return 0;
//}
//10000000 00000000 00000000 00001000
//11111111 11111111 11111111 11110111
//01111111 11111111 11111111 11111100
//00000000 00000000 00000000 00000011
//00000000 00000000 00000000 00000100
//
//int main()
//{
//	int num1 = -3;
//	int num2 = 5;
//	printf("%d\n", num1 & num2);
//	printf("%d\n", num1 | num2);
//	printf("%d\n", num1 ^ num2);
//	printf("%d\n", ~0);
//	return 0;
//}
//11111111 11111111 11111111 11111101//-3的补码
//00000000 00000000 00000000 00000101//5的补码
//
//int main()
//{
//	int a = 3;
//	int b = 5;
//	a = a + b;//结果是8
//	b = a - b;//结果是3
//	a = a - b;//结果是5
//	return 0;
//}
//int main()
//{
//	int a = 10;
//	int b = 20;
//	a = a ^ b;
//	b = a ^ b;
//	a = a ^ b;
//	printf("a = %d\n", a);
//	printf("b = %d\n", b);
//	return 0;
//}
//00000000 00000000 00000000 00001010//10
//00000000 00000000 00000000 00010100//20
//a^b
//00000000 00000000 00000000 00011110
//
int main()
{
	int a = 1;
	int b = 2;
	int c = (a > b, a = b + 10, a, b = a + 1);
	printf("%d\n", c);
	return 0;
}
